# $Id: CMakeLists.txt,v 1.14 2006/07/12 14:53:31 ppoilbarbe Exp $
# $Name:  $
#
# Build file for CMake in order to generate the documentation.
#

OPTION(MYPROJECT_DOC_WITH_STATIC "Create documentation for static members" ON)
OPTION(MYPROJECT_DOC_WITH_PRIVATE "Create documentation for private members" OFF)
OPTION(MYPROJECT_DOC_WITH_LOCAL "Create documentation for local members" OFF)
OPTION(MYPROJECT_DOC_WITH_INTERNAL "Create documentation for internal features" OFF)

MARK_AS_ADVANCED(
   MYPROJECT_DOC_WITH_PRIVATE
   MYPROJECT_DOC_WITH_STATIC
   MYPROJECT_DOC_WITH_LOCAL
   MYPROJECT_DOC_WITH_INTERNAL
)

# ---------------------------------
# Cmake modules needed
# ---------------------------------
FIND_PACKAGE(HTMLHelp)
FIND_PACKAGE(LATEX)

IF (HTML_HELP_COMPILER)
  SET(DOXYGEN_HTMLHELP YES)
ELSE (HTML_HELP_COMPILER)
  SET(DOXYGEN_HTMLHELP NO)
ENDIF (HTML_HELP_COMPILER)

IF (LATEX_COMPILER OR PDFLATEX_COMPILER)
  SET(DOXYGEN_LATEX YES)
ELSE (LATEX_COMPILER OR PDFLATEX_COMPILER)
  SET(DOXYGEN_LATEX NO)
ENDIF (LATEX_COMPILER OR PDFLATEX_COMPILER)

IF (PDFLATEX_COMPILER AND MYPROJECT_DOC_CREATE_PDF)
  SET(DOXYGEN_PDFLATEX YES)
ELSE (PDFLATEX_COMPILER AND MYPROJECT_DOC_CREATE_PDF)
  SET(DOXYGEN_PDFLATEX NO)
ENDIF (PDFLATEX_COMPILER AND MYPROJECT_DOC_CREATE_PDF)

IF (MYPROJECT_DOC_CREATE_PDF)
  SET(DOXYGEN_PDF_HYPERLINKS YES)
ELSE (MYPROJECT_DOC_CREATE_PDF)
  SET(DOXYGEN_PDF_HYPERLINKS NO)
ENDIF (MYPROJECT_DOC_CREATE_PDF)


IF (MYPROJECT_DOC_WITH_PRIVATE)
  SET(DOXYGEN_EXTRACT_PRIVATE NO)
ELSE (MYPROJECT_DOC_WITH_PRIVATE)
  SET(DOXYGEN_EXTRACT_PRIVATE NO)
ENDIF (MYPROJECT_DOC_WITH_PRIVATE)

IF (MYPROJECT_DOC_WITH_STATIC)
  SET(DOXYGEN_EXTRACT_STATIC YES)
ELSE (MYPROJECT_DOC_WITH_STATIC)
  SET(DOXYGEN_EXTRACT_STATIC NO)
ENDIF (MYPROJECT_DOC_WITH_STATIC)

IF (MYPROJECT_DOC_WITH_LOCAL)
  SET(DOXYGEN_EXTRACT_LOCAL YES)
ELSE (MYPROJECT_DOC_WITH_LOCAL)
  SET(DOXYGEN_EXTRACT_LOCAL NO)
ENDIF (MYPROJECT_DOC_WITH_LOCAL)

IF (MYPROJECT_DOC_WITH_INTERNAL)
  SET(DOXYGEN_EXTRACT_INTERNAL YES)
ELSE (MYPROJECT_DOC_WITH_INTERNAL)
  SET(DOXYGEN_EXTRACT_INTERNAL NO)
ENDIF (MYPROJECT_DOC_WITH_INTERNAL)

IF (DOT)
  SET(HAVE_DOT YES)
ELSE (DOT)
  SET(HAVE_DOT NO)
ENDIF (DOT)

SET(DOXYGEN_LANGUAGE "English" CACHE STRING "Language used by doxygen")
MARK_AS_ADVANCED(DOXYGEN_LANGUAGE)

SET(DOXYGEN_SOURCE_DIR
   ${CMAKE_SOURCE_DIR}/kernel
   ${CMAKE_SOURCE_DIR}/kernel/lib
   ${CMAKE_SOURCE_DIR}/kernel/initrd
   ${CMAKE_SOURCE_DIR}/kernel/machine
   ${CMAKE_SOURCE_DIR}/kernel/machine/pc
   ${CMAKE_SOURCE_DIR}/kernel/machine/pc/memory
   ${CMAKE_SOURCE_DIR}/kernel/machine/pc/process
   ${CMAKE_SOURCE_DIR}/kernel/machine/pc/processor
   ${CMAKE_SOURCE_DIR}/kernel/machine/pc/processor/x86
   ${CMAKE_SOURCE_DIR}/driver/system/pit
)

SET(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
STRING(REGEX REPLACE ";" " " DOXYGEN_INPUT_LIST "${DOXYGEN_SOURCE_DIR}")



CONFIGURE_FILE(doxygen.conf.in ${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf)
SET(HTML_TARGET ${DOXYGEN_OUTPUT_DIR}/refman-html/index.html)
ADD_CUSTOM_TARGET(doc-kernel
            ${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf
            DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf)
